<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <title>管理员工具箱</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrop.css">
    <link rel="stylesheet" href="css/index.css"/>
    <link rel="stylesheet" type="text/css" href="./layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="./css/layuiAdminTheme.css" />
</head>
<body id="box">
<!--主体-->
<div class="main clearfix">
    <div class="main-left">
        <div class="border-container containertop">
            <h5 class="name-title tile-size-color">工单管理工具</h5>
            <div id="radar">
                <div class="radarkong layui-inline" style="margin-top: 15%;margin-left: 3em;height: auto;width: auto">
                    <button type="button" style="width: auto" class="layui-btn layui-btn-warm layui-btn-lg" id="reDownBtn">工单列印恢复</button>
                </div>
                <div class="radarkong layui-inline" style="margin-top: 15%;margin-left: 3em;height: auto;width: auto">
                    <button type="button" style="width: auto" class="layui-btn layui-btn-warm layui-btn-lg" id="reCheckBtn">工单投料恢复</button>
                </div>
            </div>
        </div>
        <div class="border-container containerbottom">
            <div class="name-title tile-size-color">报工记录管理</div>
            <div class="graduateyear">
                <div class="radarkong layui-inline" style="margin-top: 15%;margin-left: 3em;height: auto;width: auto">
                    <button type="button" style="width: auto" class="layui-btn layui-btn-warm layui-btn-lg">清理报工记录</button>
                </div>
                <div class="radarkong layui-inline" style="margin-top: 15%;margin-left: 3em;height: auto;width: auto">
                    <button type="button" style="width: auto" class="layui-btn layui-btn-warm layui-btn-lg">报工记录删除查询</button>
                </div>
            </div>
        </div>
    </div>
    <div class="main-middle">
        <div class="border-container containertop">
            <div class="name-title tile-size-color">企业微信推送配置</div>

        </div>
        <div class="border-container containerbottom borderno-container">
            <ul class="teacher-pie clearfix">
                <li class="teacherList">
                    <div class="name-title tile-size-color">ERP配置清单</div>
                    <div class="graduateyear" style="margin-top: 15%">
                        <div id="ERP_AREA"></div>
                    </div>
                </li>
                <li class="teacherList">
                    <div class="name-title tile-size-color">用户信息管理</div>
                    <div class="radarkong layui-inline" style="margin-top: 15%;margin-left: 3em;height: auto;width: auto">
                        <button type="button" id="workerAdd_btn" style="width: auto" class="layui-btn layui-btn-warm layui-btn-lg">生产人员一键同步</button>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="main-right">
        <div class="border-container containertop">
            <div class="name-title tile-size-color">产品管理</div>
            <div class="progress1-chart" id="progress1-chart"></div>
        </div>
        <div class="border-container containerbottom">
            <div class="name-title tile-size-color">工艺流程管理</div>
            <div id="radar-chart" class="radar-chart"></div>
        </div>
    </div>
</div>
</body>


<script src="./js/main.js" charset="utf-8"></script>
<!--<script src="./js/jquery.js"></script>-->
<!--<script src="./layui/layui.js" charset="utf-8"></script>-->
<script src="https://cdn.jsdelivr.net/npm/jquery" charset="utf-8"></script>
<script src="https://www.layuicdn.com/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
    var layer = layui.layer;
    var form=layui.form;
    layui.use('element', function(){
        var element = layui.element;

        //…
    });
    $(function(){
        $.ajax({
            url: '/sys-user/getAdmin/'+sessionStorage.getItem('userId'),
            method: 'GET',
            async : false,
            contentType: 'application/json',
            success: function (res) {
               if (res.code===400){
                   layer.alert('管理员工具箱为超级管理员专属工具！权限不足！', {
                       icon: 2,
                       skin: 'layer-ext-demo' //见：扩展说明
                   },function () {
                       layer.closeAll();
                       var Tip= layer.load(3, {
                           shadeClose: false,
                           content: '非管理员不允许使用....',
                           shade: [0.8,'#fff'], //0.1透明度的白色背景
                           success: function (layero) {
                               layero.find('.layui-layer-content').css({
                                   'padding-top': '40px',//图标与样式会重合，这样设置可以错开
                                   'width': 'auto',//文字显示的宽度
                                   'font-weight': 'bold',
                                   'float-right': '50%',
                                   'float-left': '50%'
                               });
                           }
                       });
                   })
                }
            }
        })
        //erp配置清单获取
        $.ajax({
            url: '/admin/getErpSetting',
            method: 'POST',
            async : false,
            contentType: 'application/json',
            success: function (res) {
                if (res.code===200){
                    for(var i=0;i<res.data.length;i++){
                        var trs="<p class='layui-font-8' style='margin: 5px;color:white;'> ● "+res.data[i]+"</p>";
                        $('#ERP_AREA').append(trs)
                    }
                }
            }
        })
    })
    //列印恢复
    $('#reDownBtn').click(function () {
        layer.open({
            type: 1,
            title: '工单列印恢复',
            shadeClose: true,
            shade: false,
            skin: 'layui-layer-rim',
            area: ['50%', '35%'],
            content: '<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">' +
                '  <ul class="layui-tab-title">' +
                '    <li class="layui-this">单张工单恢复</li>' +
                '    <li>多张工单恢复</li>' +
                '  </ul>' +
                '  <div class="layui-tab-content">' +
                '   <div class="layui-tab-item layui-show">' +
                '       <div class="layui-inline" style="width: auto;margin-top: 5%">' +
                '           <label class="layui-form-label" style="width: auto">恢复的工单号：</label>' +
                '           <div class="layui-input-inline" style="width: auto;">' +
                '             <input type="text" style="width: 20em" name="orderNum" placeholder="输入工单号" autocomplete="off" class="layui-input">' +
                '           </div>' +
                '           <button type="button" class="layui-btn" id="reDownSub_One">提交恢复</button>' +
                '       </div>' +
                '   </div>' +
                '   <div class="layui-tab-item">  ' +
                '       <div class="layui-inline" style="width: auto;margin-top: 5%">' +
                '           <label class="layui-form-label" style="width: auto">恢复范围：</label>' +
                '           <div class="layui-input-inline" style="width: auto;">' +
                '             <input type="text" style="width: 20em" name="orderNum_min" placeholder="输入工单号" autocomplete="off" class="layui-input">' +
                '           </div>' +
                '           <div class="layui-input-inline" style="width: auto;">' +
                '             <div class="layui-form-mid">-</div>' +
                '             <input type="text" style="width: 20em" name="orderNum_max" placeholder="输入工单号" autocomplete="off" class="layui-input">' +
                '           </div>' +
                '           <button type="button" class="layui-btn" id="reDownSub_Range">提交恢复</button>' +
                '       </div>' +
                '   </div>' +
                '  </div>' +
                '</div>'
        });

        //单张工单恢复
        $('#reDownSub_One').click(function () {
            var orderNum=$("input[name='orderNum']").val();
            if(orderNum==null){
                layer.msg("工单号不能为空!")
            }else {
                $.ajax({
                    url: url + '/work-order/reDownOfOne',
                    method: 'POST',
                    async : false,
                    data: JSON.stringify({
                        orderNum:orderNum
                    }),
                    contentType: 'application/json',
                    success: function(res) {
                        layer.msg(res.msg);
                    }
                })
            }
        })
        //多张工单恢复
        $('#reDownSub_Range').click(function () {
            var orderNum_min=$("input[name='orderNum_min']").val();
            var orderNum_max=$("input[name='orderNum_max']").val();
            if(orderNum_min==null||orderNum_max==null){
                layer.msg("工单号不能为空!")
            }else {
                $.ajax({
                    url: url + '/work-order/reDownOfRange',
                    method: 'POST',
                    async : false,
                    data: JSON.stringify({
                        orderNumMin:orderNum_min,
                        orderNumMax:orderNum_max
                    }),
                    contentType: 'application/json',
                    success: function(res) {
                        layer.msg(res.msg);
                    }
                })
            }
        })
    })
    //投料恢复
    $('#reCheckBtn').click(function () {
        layer.open({
            type: 1,
            title: '工单投料检录恢复',
            shadeClose: true,
            shade: false,
            area: ['50%', '50%'],
            content: '<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">' +
                '  <ul class="layui-tab-title">' +
                '    <li class="layui-this">单张工单恢复</li>' +
                '    <li>多张工单恢复</li>' +
                '  </ul>' +
                '  <div class="layui-tab-content">' +
                '   <div class="layui-tab-item layui-show">暂未开放</div>' +
                '   <div class="layui-tab-item">暂未开放</div>' +
                '  </div>' +
                '</div>'
        });
    })
</script>
</html>
